package com.partsoft.dits.dsm;

import java.sql.Connection;

import javax.sql.DataSource;

public class DefaultDsmSQLProviderFactory extends ResourceDsmSQLProviderFactory {

	private static DsmSQLProviderFactory __PROXY__ = new DsmSQLProviderFactory() {

		public DsmSQLProvider getDsmSQLProvider(String dspName) {
			return getInstance().getDsmSQLProvider(dspName);
		}

		public DsmSQLProvider getDsmSQLProvider(Connection conns) {
			return getInstance().getDsmSQLProvider(conns);
		}

		public DsmSQLProvider getDsmSQLProvider(DataSource ds) {
			return getInstance().getDsmSQLProvider(ds);
		}
	};

	public static DefaultDsmSQLProviderFactory __INSTANCE__;

	public DefaultDsmSQLProviderFactory() {
		super();
	}

	DefaultDsmSQLProviderFactory(String[] dsmOriginalSqlLocations) {
		super(dsmOriginalSqlLocations);
	}

	public static DsmSQLProviderFactory get() {
		return __PROXY__;
	}

	private static DefaultDsmSQLProviderFactory getInstance() {
		synchronized (__PROXY__) {
			if (__INSTANCE__ == null) {
				__INSTANCE__ = new DefaultDsmSQLProviderFactory(new String[] {
					"classpath:/com/partsoft/dits/dsm/db2.sql", 
					"classpath:/com/partsoft/dits/dsm/mssql2k.sql",
					"classpath:/com/partsoft/dits/dsm/mssql2k5.sql",
					"classpath:/com/partsoft/dits/dsm/mssql2k8.sql",
					"classpath:/com/partsoft/dits/dsm/mssql2012.sql",
					"classpath:/com/partsoft/dits/dsm/oracle.sql" 
				});
			}
			return __INSTANCE__;
		}
	}
}
